from modules.vo.common_vo import CrudResponseModel
from modules.vo.dept_vo import DeptQueryModel, DeptModel
from modules.dao.dept_dao import DeptDAO
from utils.common_util import CamelCaseUtil


class DeptService:



    @staticmethod
    def get_all_depts():
        pass

    @classmethod
    async def get_dept_list_services(cls, dept_query: DeptQueryModel):
        """
            获取部门列表信息 service
        :param dept_query:  DeptQueryModel
        :return: 
        """

        dept_list = await DeptDAO.get_dept_list_dao(dept_query)
        # print("dept_list: ", type(dept_list),dept_list)
        return CamelCaseUtil.transform_result(dept_list)
        # return dept_list


    @classmethod
    async def add_dept_services(cls, dept_model: DeptModel):

        try:
            await DeptDAO.add_dept_dao(dept_model)
            return CrudResponseModel(is_success=True, message="新增部门成功")
        except Exception as e:
            raise e



